{extend name="public/base" /}

{block name="title"}<title>{if $data}{:lang('edit')}{else /}{:lang('create')}{/if}</title>{/block}

{block name="pjax_container"}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">{:lang('base_param')}</a></li>
                        <li><a href="#tab2" data-toggle="tab">{:lang('advanced_param')}</a></li>
                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm"><i class="fa fa-list"></i> {:lang('back')}</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab1">
                            {:widget('common/Hidden/index', [$data, [
                                'name' => 'id',
                            ]])}
                            {:widget('common/Select/index', [$data, [
                                'name' => 'pid',
                                'title' => lang('pid'),
                                'from' => 'function',
                                'fromcfg' => ['arctyp_tree'],
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'typename',
                                'title' => lang('typename'),
                                'placeholder' => lang('typename'),
                            ]])}
                            {:widget('common/FileUpload/index', [$data, [
                                'name' => 'litpic',
                                'title' => lang('litpic'),
                                'placeholder' => lang('litpic'),
                            ]])}
                            {:widget('common/Content/index', [$data, [
                                'name' => 'content',
                                'title' => lang('content'),
                            ]])}
                            {:widget('common/Select/index', [$data, [
                                'name' => 'status',
                                'title' => lang('status'),
                                'from' => 'selectlist',
                                'fromcfg' => 'status',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'sorts',
                                'title' => lang('sorts'),
                                'placeholder' => lang('sorts'),
                                'default_val' => '50',
                            ]])}
                        </div>
                        <div class="tab-pane" id="tab2">
                            {:widget('common/Select/index', [$data, [
                                'name' => 'mod',
                                'title' => lang('mod'),
                                'from' => 'selectlist',
                                'fromcfg' => 'arctype_mod',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'jumplink',
                                'title' => lang('jumplink'),
                                'placeholder' => lang('jumplink'),
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'dirs',
                                'title' => lang('dirs'),
                                'placeholder' => lang('dirs'),
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'keywords',
                                'title' => lang('keywords'),
                                'placeholder' => lang('keywords'),
                            ]])}
                            {:widget('common/Textarea/index', [$data, [
                                'name' => 'description',
                                'title' => lang('description'),
                                'placeholder' => lang('description'),
                            ]])}
                            {:widget('common/Radio/index', [$data, [
                                'name' => 'target',
                                'title' => lang('target'),
                                'from' => 'selectlist',
                                'fromcfg' => 'target',
                                'default_val' => '_self',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'icon',
                                'title' => lang('icon'),
                                'placeholder' => lang('icon'),
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'templist',
                                'title' => lang('templist'),
                                'placeholder' => lang('templist'),
                                'default_val' => 'list_archive',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'temparticle',
                                'title' => lang('temparticle'),
                                'placeholder' => lang('temparticle'),
                                'default_val' => 'article_archive',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'pagesize',
                                'title' => lang('pagesize'),
                                'placeholder' => lang('pagesize'),
                                'default_val' => '20',
                            ]])}
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-6">
                            <div class="btn-group">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {:lang('submit')}">{:lang('submit')}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    $('input[name="jumplink"]').closest('.form-group').addClass('hide').attr('id', 'jumplink');
    
    $('select[name="mod"]').change( function() {
        if($(this).val() == 'jump'){
            $('#jumplink').removeClass('hide');
        }else{
            var mod_list = "list_" + $(this).val();
            var mod_article = "article_" + $(this).val();
            $("input[name='templist']").val(mod_list);
            $("input[name='temparticle']").val(mod_article);
            $("#jumplink").addClass("hide");
        }
    });
    {if !$data && is_array($data)}
    $('select[name="mod"]').change();
    {/if}
})
</script>
{/block}